package com.kuang.springboot2board.dao;

import com.kuang.springboot2board.pojo.Department;
import org.springframework.stereotype.Repository;

import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

/**
 * @author Gerald
 * @date 2022/6/13-20:53
 */
@Repository
public class DepartmentDao {
    private static Map<Integer, Department> departments=null;


    static {
        departments=new HashMap<Integer,Department>();
        departments.put(101,new Department(101,"教学部"));
        departments.put(102,new Department(102,"后勤部"));
        departments.put(103,new Department(103,"学习部"));
        departments.put(104,new Department(104,"运营部"));
        departments.put(105,new Department(105,"销售部"));
    }


    public Collection<Department> getDepartments(){
        return departments.values();
    }
    public Department getDepartmentById(Integer id){
        return departments.get(id);
    }

}
